package edu.umn.contactviewer;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;

/**
 * The home screen of the application.
 * 
 */
public class HomeActivity extends Activity {
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);

		findViewById(R.id.contacts_button).setOnClickListener(
				new OnClickListener() {
					public void onClick(View v) {
						Intent intent = new Intent(HomeActivity.this,
								ContactListActivity.class);
						startActivity(intent);
					}
				});

		findViewById(R.id.about_button).setOnClickListener(
				new OnClickListener() {
					public void onClick(View v) {
						AlertDialog alertDialog = new AlertDialog.Builder(
								HomeActivity.this).create();
						alertDialog.setTitle(getString(R.string.about_title));
						alertDialog.setMessage(getString(R.string.about_content));
						alertDialog.setButton(getString(R.string.ok),
								new DialogInterface.OnClickListener() {
									public void onClick(DialogInterface dialog,
											int which) {
										return;
									}
								});
						alertDialog.show();
					}
				});
	}
}